<?php
    /**
     * Created by PhpStorm.
     * User: Archer
     * Date: 2016/4/7
     * Time: 14:35
     */
namespace util\plugin;

class regexp{
    static function mobile($mobile){
        return preg_match('/^1[3|4|5|7|8]\d{9}$/',$mobile);
    }

    static function date($date){
        return preg_match('/^\d{4}-\d{1,2}-\d{1,2}$/',$date);
    }

    static function dateTime($dateTime)
    {
        return preg_match("/^\d{4}-\d{1,2}-\d{1,2}\s+\d{1,2}:\d{1,2}:\d{1,2}$/",$dateTime);
    }

    static function checkNo($no = '' , $brand = 'sto')
    {
        if(preg_match("/(\d{6}|\d{10})/",$no) && $brand == 'sto') return true;
        elseif(preg_match("/^[0-9]{4}[a-zA-Z0-9]{1}(\.+\d+)?/",$no) && $brand == 'zt') return true;
        return false;
    }
}
